package com.zhangshuo.patternDesign.vistor;

/**
 * Created by shuo.zhang on 2017-11-04.
 *
 * 老板会比较关注一共花了多少，一共收了多少钱
 *
 */
public class Boss implements IVisitor {
    private double incomeCount;
    private double consumeCount;

    @Override
    public void visit(IncomeBill bill) {
        incomeCount += bill.getCount();
    }

    @Override
    public void visit(ConsumeBill bill) {
        consumeCount += bill.getCount();
    }

    /**
     * 获取总的收入
     * @return
     */
    public double getIncomeCount() {
        System.out.println(String.format("老板查帐，一共收入了:%d",(int)this.incomeCount));
        return incomeCount;
    }

    /**
     * 获取总的支出
     * @return
     */
    public double getConsumeCount() {
        System.out.println(String.format("老板查帐，一共支出了:%d",(int)this.consumeCount));
        return consumeCount;
    }
}
